/**
 * Created by fengxingck on 2017/4/6.
 */
import java.util.Scanner;
import java.math.BigDecimal;
public class sizeyunsuan {
    public static void main(String[] args) {
        String name1="加法";
        String name2="减法";
        String name3="乘法";
        String name4="除法";
        Scanner scanner=new Scanner(System.in);
        System.out.printf("开始四则运算%n");
        System.out.printf("选择加法、减法、乘法、除法:");
        String str=new String(scanner.nextLine());
        System.out.printf("请输入数字，两数字以空格分割:");
        if(name1.equals(str)){
            BigDecimal a=new BigDecimal(scanner.nextFloat());
            BigDecimal b=new BigDecimal(scanner.nextFloat());
            System.out.printf("结果是%f%n",a.add(b));
        }
        else if(name2.equals(str)){
            BigDecimal a=new BigDecimal(scanner.nextFloat());
            BigDecimal b=new BigDecimal(scanner.nextFloat());
            System.out.printf("结果是%f%n",a.subtract(b));
        }
        else if(name3.equals(str)){
            BigDecimal a=new BigDecimal(scanner.nextFloat());
            BigDecimal b=new BigDecimal(scanner.nextFloat());
            System.out.printf("结果是%f%n",a.multiply(b));
        }
        else if(name4.equals(str)){
            BigDecimal a=new BigDecimal(scanner.nextFloat());
            BigDecimal b=new BigDecimal(scanner.nextFloat());
            System.out.printf("结果是%f%n",a.divide(b));
        }
        else System.out.printf("输入不合法");
    }
}